-
Notifications
You must be signed in to change notification settings - Fork 46
Config loaders #1116
base: develop
Are you sure you want to change the base?
Config loaders #1116
Conversation
Hi @stanislaw47 Thanks a lot for this contribution!, here are a few preliminary comments:
|
Hi @cpascual
I'm happy to hear it
Actually, it's there, in here. Resulting
I got trouble getting my head around pyconf since it support noto only extension but also directories and non-exisitng paths. But if it'll be treated as special fallback case, then I would be trivial indeed. I'll try to implement it soon.
I am happy to remove deprecated stuff like
For now, only compatibility is indeed
Sure think, will do. I've written some tests using pytest so that should not be a problem.
Dumping configuration in given format would be cool feature. However, I think that might be non-trivial for py files. And could make this PR much bigger. Regarding plugins - should they support both loading and dumping configuration? Or just loading should be mandatory and dumping a feature? I personally would go for both loading and dumping as mandatory. |
…into config_loaders
Hi @cpascual I would appreciate review to validate that this approach is good enough. |
ok... give me a bit of time (I've my hands full adapting the testsuite so that it can be run with gitlab-ci). But do not hesitate to ping if I forget |
Hello Taurus community
This PR provides what I wanted in Taurus for long time: ability for load configuration for TaurusGUI from JSON.
I created abstraction for config source, be it a Python module or XML/JSON file. In that way, adding support for any other config file format, like TOML or YAML should be trivial. TaurusGUI now loads configuration by accessing fields of
*ConfigLoader
class. Whole interface of*ConfigLoader
class is defined inAbstractConfigLoader
by using Pythonabc
module.All discovery logic happens in
taurus.qt.qtgui.taurusgui.config_loader.getLoader
function. It matches loaders by file extensions. In case of directory or non-existing path, it tries to usePyConfigLoader
. In case of using entry-points, logic has to be moved elsewhere but for the moment I do not know how to achieve it, especially when taking into account possibility to pass directory and Python module path.Regarding
abc.ABC
class for Python 2 and 3 - I know that Taurus usesfuture
package for compatibility. However, I did not found anything there about providingabc.ABC
so I created my own compatibility from what I found on StackOverflow.Things to do: